export default function MapLoader() {
    return new Promise((resolve, reject) => {
        if (window.AMap) {
            resolve(window.AMap)
        } else {
            window._AMapSecurityConfig = {
                securityJsCode:'cc8054b95be2460e37f7e0395f930d2c',
              }
            var script = document.createElement('script')
            script.type = 'text/javascript'
            script.async = true
            script.src =
                'https://webapi.amap.com/maps?v=1.4.11&callback=initAMap&key=c146a35d379516fe515436212fbebdf4',
            script.onerror = reject
            document.head.appendChild(script)
        }
        window.initAMap = () => {
            resolve(window.AMap)
        }
    })
}
